import 'package:flutter/material.dart';


/*
 * 2019.12.18
 * DingHL
 * 左边图标字体，右边图标，左右两边对齐样式
 * 左边图标字体，右边图标，左右两边对齐样式封装页面调用示例
                     IconTextIcon(
                      iconLeft: Icons.audiotrack,
                      iconRight: Icons.chevron_right,
                      text: "QQ音乐",
                      iconLeftColor: Colors.greenAccent,
                      onTap: (){
                        Navigator.pop(context);
                        BotToastCall.ShowMessage( "照片上传失败请重试！");//普通文本 默认2秒 底下弹出
                      },
                    ),
 */

///todo:左边图标字体，右边图标，左右两边对齐样式
class IconTextIcon extends StatefulWidget {
  double width;
  Color iconLeftColor;
  Color iconRightColor;
  IconData iconRight;
  IconData iconLeft;
  double iconRightSize;
  double iconLeftSize;
  double textSize;
  VoidCallback onTap; //点击事件
  String text;
  Color textColor;
  double height;

  IconTextIcon({
    Key key,
    this.iconLeftColor:Colors.black12,
    this.iconRightColor:Colors.black12,
    this.iconRight,
    this.iconLeft,
    this.iconRightSize:25,
    this.iconLeftSize:25,
    this.textSize:15,
    this.onTap,
    this.width,
    this.text,
    this.textColor:Colors.black,
    this.height:50.0,
  }):super(key:key);


  @override
  _IconTextIconState createState() => _IconTextIconState();
}
class _IconTextIconState extends State<IconTextIcon> {
  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: widget.onTap,
      child: Container(
//        width: widget.width,
        height: widget.height,
        color: Colors.white,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[
            //左边
            InkWell(
                child:Container(
                  margin:
                  EdgeInsets.fromLTRB(0, 10, 10, 10),
                  child: Padding(
                    padding: EdgeInsets.fromLTRB(0, 3,0, 4),
                    child: Row(
                      children: <Widget>[
                        //小图标
                        Container(
                          padding: EdgeInsets.fromLTRB(0, 0, 8, 0),
                          alignment: Alignment.centerRight,
                          child: Icon(
                            widget.iconLeft,
                            color: widget.iconLeftColor,
                            size: widget.iconLeftSize,
                          ),
                        ),
                        Container(
                          alignment: Alignment.center,
                          child: Text(
                            widget.text,
                            style: TextStyle(
                                color: widget.textColor,
                                fontSize: widget.textSize),
                            textAlign: TextAlign.center,
                          ),
                        ),
                      ],
                    ),
                  ),
                )
            ),
            //右边
            Container(
              child: Row(
                children: <Widget>[
                  //小图标
                  Container(
                    padding: EdgeInsets.fromLTRB(0, 0, 8, 0),
                    alignment: Alignment.centerRight,
                    child: Icon(
                      widget.iconRight,
                      color: widget.iconRightColor,
                      size: widget.iconRightSize,
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
        padding: EdgeInsets.only(
            left: 12,right: 9
        ),
      ),
    );

  }
}